package live.jialing.sip.base.repository;

import live.jialing.core.data.jpa.CustomJpaRepository;
import live.jialing.sip.base.domain.Parent;
import org.springframework.data.jpa.repository.Query;

/**
 * 家长
 */
public interface ParentRepository extends CustomJpaRepository<Parent, Long> {

    /**
     * 获取家长详情，包含孩子
     *
     * @param parentId 家长id
     * @return
     */
    @Query("select p from Parent p left join fetch p.children where p.id = ?1")
    Parent findParentFetchChildByPK(long parentId);
}